<?php 
namespace app\index\controller;
use think\Controller;
class Wechat extends Base {
	
	public function index(){
		$echoStr = $_GET["echostr"];
        if($this->checkSignature()){
            echo $echoStr;
            exit;
        }
	}
	
	private function checkSignature(){
        $token = 'lzh';
		
        $signature 	= $_GET["signature"];
        $timestamp 	= $_GET["timestamp"];
        $nonce 		= $_GET["nonce"];         
        
        $tmpArr = array($token, $timestamp, $nonce);
        sort($tmpArr);
        $tmpStr =  sha1( implode( $tmpArr ) );
        if( $tmpStr == $signature ){
            return true;
        }else{
            return false;
        }
    }
	

	
	
	
}